package com.lsk.mps.backend.mapper;

import com.lsk.mps.backend.model.Message;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageMapper {
    @Select("select * from message limit ${offset}, #{rows}")
    List<Message> queryAllMessage(@Param("offset") Integer offset, @Param("rows") Integer rows);
    @Select("select count(id) from message")
    Integer messageCount();
    @Insert("insert into message(title, message, type, publishDate, needConfirm) values(#{title}, #{message}, #{type}, #{publishDate}, #{needConfirm})")
    void addMessage(Message message);
}
